/**
 * Created by Caster on 2014/11/21 0021.
 */
$(document).ready(function(){

    $(".btn_menu").off().on('click',function(){
        if($(".menu").attr("data-status") == "show"){
            $(".menu").attr("data-status","hide");
            $(".cover").hide();
            $(".container").css({'height':'','overflow':'auto'});
        }else{
            $(".menu").attr("data-status","show");
            $(".cover").show();

            var height = $(window).height() - 75 - 111;
            $(".container").css({'height':height+'px','overflow':'hidden'});
        }
    });

    $(".cover").off().on('click',function(){
        $(".menu").attr("data-status","hide");
        $(".cover").hide();
        $(".container").css({'height':'','overflow':'auto'});
    });

    $(".term-list-btn").off().on('click',function(){
        if($(".term-list-btn ul").attr("data-status")=="show"){
            $(".term-list-btn ul").attr("data-status","hide");
        }else{
            $(".term-list-btn ul").attr("data-status","show");
        }
    });

    $(".product-detail-tab .control_img").off().on('click',function(){
        $(".product-detail-tab .selected").removeClass('selected');
        $(".product-detail-tab .control_img").addClass('selected');
        $(".product-detail-img-box").addClass('selected');
        $(".product-detail-prm-box").removeClass('selected');
    });

    $(".product-detail-tab .control_prm").off().on('click',function(){
        $(".product-detail-tab .selected").removeClass('selected');
        $(".product-detail-tab .control_prm").addClass('selected');
        $(".product-detail-img-box").removeClass('selected');
        $(".product-detail-prm-box").addClass('selected');
    });

    $(".menu").css('height',$(window).height()-75);

    $(".btn_back").click(function(){
        if(window.history.length > 1){
            window.history.go( -1 );
        }else{
            window.location = "/";
        }
    });

});




